package com.iwat.service;

import com.iwat.vo.AccessTokenVO;
import com.iwat.vo.WeixinResponseResult;
import com.iwat.vo.WeixinUserInfoVO;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author wangweiqiang
 * @Classname WeixinService
 * @Date 2022/3/27 16:26
 * @Description TODO
 */
public interface WeixinService {
    /**
     * 根据AppID和AppSecret获取access_token
     *
     * @param appId:
     * @param appSecret:
     * @return: com.zhengqing.demo.modules.weixin.model.AccessTokenVO
     */
    AccessTokenVO getAccessToken(String appId, String appSecret);


    /**
     *
     * 获取openID
     *
     * @param request
     * @param response
     */
    void getOpenId(HttpServletRequest request, HttpServletResponse response);

    /**
     * 获取用户信息
     * @param openid
     * @param accessToken
     * @return
     */
    WeixinUserInfoVO getUserInfo(String openid, String accessToken);


    /**
     * 刷新token
     * @param appId
     * @param refreshToken
     * @return
     */
    String refreshAccessToken(String appId, String refreshToken);

    /**
     * 检查token是否有效
     * @param openId
     * @param accessToken
     * @return
     */
    WeixinResponseResult checkAccessToken(String openId, String accessToken) throws Exception;
}
